<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
//JHtml::_('behavior.tooltip');
JPluginHelper::importPlugin('content');
$dispatcher	= JDispatcher::getInstance();
if (!class_exists('plgContentLightShop')) {
	JError::raiseWarning(50, str_rot13('WYVO_FUBC_REEBE_YBNQ_CYHTVA'));
}
?>
<link rel="stylesheet" href="<?php echo JURI::root().'components/com_shop/assets/'; ?>cart.css" type="text/css" />
<form action="<?php echo JRoute::_('index.php?option=com_shop&task=cart.update'); ?>" method="post" enctype="multipart/form-data" class="shop-orcer" id="shop-order">
<table  class="viewcart" width="100%" cellpadding="0" cellspacing="0">
<thead>	<tr><td colspan="5"><div class="title_cart"><?php echo JText::_('VIEW CART'); ?></div></td></tr>
<tr>
    	<td class="title_cart_product"><?php echo JText::_('PICTURE'); ?></td><td class="title_cart_product"><?php echo JText::_('PRODUCT'); ?></td><td class="title_cart_product"><?php echo JText::_('PRICE'); ?></td><td class="title_cart_product"><?php echo JText::_('QUANTITY'); ?></td><td class="title_cart_product"><?php echo JText::_('TOTAL PRICE'); ?></td>
    </tr>
</thead>
<?php if($this->carts):?>
<tbody>
    <?php foreach($this->carts as $cart):?>
    <tr>
    	<td align="center">
        	<a href="<?php echo JRoute::_('index.php?option=com_shop&view=detail&id='.$cart['id'].':'.$cart['alias']); ?>" target="_blank"><img src="<?php echo $this->path_img.$cart['image']; ?>" title="<?php echo $cart['title']; ?>" width="100" height="100" class="shop-cart-imgage" /></a>
        </td>
        <td class="shop-title-product-view-cart">
        <a href="<?php echo JRoute::_('index.php?option=com_shop&view=detail&id='.$cart['id'].':'.$cart['alias']); ?>" target="_blank"><?php echo $cart['title']; ?></a>
        </td>
        <td class="shop-price-product-view-cart">
        <?php $dispatcher->trigger('onFormatPrice',array($cart['price'],$cart['currency'],&$price)); echo $price; ?>
        </td>
        <td class="shop-quantity-product-view-cart">
        <input type="text" name="quantity[<?php echo $cart['id']; ?>]" value="<?php echo $cart['quantity']; ?>" size="2" />
        <a rel="nofollow" href="javascript:;" onclick="updateshop();"><img src="<?php echo JURI::root().'components/com_shop/assets/update.png'; ?>" /></a>
        <a rel="nofollow" href="<?php echo JRoute::_('index.php?option=com_shop&task=cart.delete&productid='.$cart['id']); ?>"><img src="<?php echo JURI::root().'components/com_shop/assets/delete.png'; ?>" /></a>
        </td>
        <td class="shop-total-price-view-cart">
<?php $dispatcher->trigger('onFormatPrice',array($cart['price']*$cart['quantity'],$cart['currency'],&$price)); echo $price; ?>
        </td>
    </tr>
    <?php endforeach;?>
</tbody>
<tfoot>
<tr>
	<td colspan="5">
<?php 
$total = 0;
$currency = '';
foreach($this->carts as $cart){
	$total +=$cart['price']*$cart['quantity'];
	$currency = $cart['currency'];
}


?>
    <div class="shop-button-total">
    	<div class="shop-button-total-text"><span class="shop-bt-tt-sp"><?php echo JText::_('TOTAL PRICE'); ?>: </span><?php $dispatcher->trigger('onFormatPrice',array($total,$currency,&$total)); echo $total; ?></div>
    </div>
    </td>
</tr>
</tfoot>
<?php else:?>
<tr><td colspan="5"><div class="emptyproduct"><?php echo JText::_('NO PRODUCT IN CART'); ?></div></td></tr>
<?php endif;?>
</table>
</form>
<div class="shop-button-next-prev">
<div class="shop-button-prev-lft"><a href="<?php echo JURI::root(); ?>" title="<?php echo JText::_('BACK SHOP CONTINUTE'); ?>" class="shop-button-prev"><?php echo JText::_('BACK SHOP'); ?></a></div>
<?php if($this->carts):?>
<div class="shop-button-prev-rgt"><a href="<?php echo JRoute::_('index.php?option=com_shop&view=cart&layout=infomation'); ?>" title="<?php echo JText::_('CONTINUTE SHOP CONTINUTE'); ?>" class="shop-button-next"><?php echo JText::_('CONTINUTE'); ?></a></div>
<?php endif; ?>
</div>

<script type="text/javascript">
function updateshop(){	var $doc = document.getElementById('shop-order'); $doc.submit();}
</script>